<template>
    <el-card shadow="never" class="card-border-none">
        <template #header>
            <div class="card-header">
                <span class="card-header-span">{{ title }}</span>
                <el-tag type="danger" size="small" effect="plain">{{ tip }}</el-tag>
            </div>
        </template>
        <el-row :gutter="20">
            <template v-if="btns.length == 0">
                <el-col :span="6" v-for="i in 4" :key="i">
                    <el-skeleton style="width: 100%;" loading animated>
                        <template #template>
                            <el-card>
                                <div class="card-card-content">
                                    <el-skeleton-item variant="h3" style="width: 30%"/>
                                    <el-skeleton-item variant="h3" style="width: 70%;margin-top: 10px" />
                                </div>
                            </el-card>
                        </template>
                    </el-skeleton>
                </el-col>
            </template>
            <el-col :span="6" v-for="(item,index) in btns" :key="index">
                <el-card shadow="hover" class="card-boder-none-color">
                    <div class="card-card-content">
                        <count-to :value="item.value"></count-to>
                        <span class="text-status">{{ item.label }}</span>
                    </div>
                </el-card>
            </el-col>
        </el-row>
  </el-card>
</template>
<script setup>
import CountTo from '~/components/CountTo.vue'
defineProps({
    title:String,
    tip:String,
    btns:Array
})
</script>
<style lang="scss" scoped>
// 可复用
@mixin center() {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}
.card-border-none {
    border: none;
    .card-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        .card-header-span {
            font-size: 14px;
        }
    }
    .card-card-content {
        @include center;
        font-size: 20px;
        .text-status {
            font-size: 12px;
            color: #6b7280;
            margin-top: 10px;
        }
    }
    .card-boder-none-color {
        border: none;
        background: #f6f6f6;
    }
}
</style>